import sqlite3 as sql
import pandas as pd

name = input('请输入教师姓名：')
name = '%'+name +'%'
con = sql.connect('df_lesson_list.db')
query = con.execute('select 课程名称,起周,止周,上课星期,起止节,教室 from lessonlist where 上课教师 like "%s"' %name)
df = []
for i in query:
    df.append(i)
df_query = pd.DataFrame(df,columns=('课程名称','起周','止周','上课星期','起止节','教室'))
df_query = df_query.sort(columns='上课星期')
df_query = df_query.set_index('上课星期')
df_query = df_query.T
con.close()
if not df_query.empty:
    print(df_query)
else:
    print('对不起，没查到')